function m2 = mode2m2(mode_values,L_0,dx)
m2 = 0.0;
l  = L_0/dx;
mode = size(mode_values,2)-1;
for n = 0:mode
    if n==0 || 2*n==l
        K = 8*sin(pi*n/l)^2/(L_0*dx*dx);
%         K = 0;
    else
        K = 4*sin(pi*n/l)^2/(L_0*dx*dx);
    end
    m2 = m2+K*(mode_values(1,n+1).^2)+K*(mode_values(2,n+1).^2);
end

